public class twoSum {
    //和为s的两个数
    public int[] twoSum(int[] price, int target) {
        int left = 0,right = price.length-1;
        while(left < right){
            int sum = price[right]+price[left];
            if(sum > target){

                right--;
            } else if(sum<target){
                left++;
            } else {
                int[]ret = {price[right],price[left]};
                return ret;
            }
        }
        return new int[]{0};
    }
}
